﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using System.Data;
using System.Web;
using System.Data.SqlClient;

namespace Leefish.Market.PRO
{
    public class Const
    {
      
        private static string _SystemName;
        private static string _CookieName;
        private static string _DomainName;
        private static string _Run;

     
        private static string _DefaultIp = "0.0.0.0";
        private static string _LoginKeyCauda = "#$%-HJL-406D";
        public const int PageSize = 20;

        /// <summary> 模块地址 </summary>
        public static readonly string MODULE_PATH = ConfigurationManager.AppSettings["ModulePath"] ?? "";


        /// <summary>模块缓存的KEY</summary>
        public const string CACHE_MODULE = "EXT_MODULE";

        /// <summary>新闻模块</summary>
        public const int Module_News = 10;

        /// <summary>人才招聘模块</summary>
        public const int Module_Job = 20;

        /// <summary>公司简介模块</summary>
        public const int Module_Intro = 30;

        ///<summary>登录验证随机码附加验证串尾数</summary>
        public static string LoginKeyCauda
        {
            get { return _LoginKeyCauda; }
        }

        public const string CookieName = "NEWMARK-SHOES";
        public const string DomainName = "Default";
        public enum RunType
        {
            DeBug = 0,
            Release = 1,
        }

        /// <summary>
        /// 系统运行状态
        /// </summary>
        public static RunType Run
        {
            get
            {
                if (String.IsNullOrEmpty(_Run))
                {
                    return RunType.DeBug;
                }

                if(String.IsNullOrEmpty(_Run))
                {
                    return RunType.Release;
                }

                if (_Run.ToUpper() == RunType.DeBug.ToString().ToUpper())
                {
                    return RunType.DeBug;
                }

                return RunType.Release;
            }
        }     

       
   
        /// <summary>
        /// 获取客户端IP
        /// </summary>
        public static string ClientIP
        {
            get
            {
                if (HttpContext.Current != null)
                {
                    string result = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                    if (string.IsNullOrEmpty(result))
                        result = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
                    if (string.IsNullOrEmpty(result))
                        result = HttpContext.Current.Request.UserHostAddress;
                    return result;
                }
                else
                    return "0.0.0.0";
            }
        }

    }
}
